<!DOCTYPE html>
<head>
    <script src="/ierp/dfile/js/jquery.js" type="text/javascript"></script></head>
<body>
username: <input type="text" id="username"><br><br>
password: <input type="password" id="password"><br><br>
<button id="loginbtn">登录</button>
</body>
<script type="text/javascript">
    jQuery(function($) {
        $(document).ready(function () {
            $('#loginbtn').click(function () {
                var param = {
                    username: $("#username").val(),
                    password: $("#password").val()
                };
                $.ajax({
                    type: "post",
                    url: "checkLogin",
                    data: param,
                    dataType: "json",
                    success: function (data) {
                        alert(data.success);
                        if (data.success == false) {
                            alert(data.errorMsg);
                        } else {
                            //登录成功
                            window.location.href = "<%=request.getContextPath()%>" + "/loginsuccess.jhtml";
                        }
                    },
                    error: function (data) {
                        alert("调用失败....");
                    }
                });
            });
        });
    });
</script>
</html>